package cst.a720yyq.zyfypt_720yyq.View.Fragment;


import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import cst.a720yyq.zyfypt_720yyq.CollectActivity;
import cst.a720yyq.zyfypt_720yyq.FocusActivity;
import cst.a720yyq.zyfypt_720yyq.Interface.ToudouListener;
import cst.a720yyq.zyfypt_720yyq.MainActivity;
import cst.a720yyq.zyfypt_720yyq.Modle.ResModle;
import cst.a720yyq.zyfypt_720yyq.R;

/**
 * A simple {@link Fragment} subclass.
 */
public class MyFragment extends Fragment {
    private Button btn_Co,btn_ho,btn_back,btn_logout;
    private Intent Bintent,intentC,intentH;
    private ToudouListener<String> listener;
    private SharedPreferences sp;
    private ResModle modle;
    private SharedPreferences.Editor editor;

    public MyFragment() {
        // Required empty public constructor
    }


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {


        View view = inflater.inflate(R.layout.fragment_fragment5, container, false);
        btn_back =(Button)view.findViewById(R.id.btn_back);
        btn_Co=(Button)view.findViewById(R.id.btn_co);
        btn_ho=(Button) view.findViewById(R.id.btn_ho);
        btn_logout=(Button)view.findViewById(R.id.btn_logout);
        intentC =new Intent(getActivity(), CollectActivity.class);
        intentH=new Intent(getActivity(), FocusActivity.class);
        sp = getActivity().getSharedPreferences("ME", Context.MODE_PRIVATE);
        editor=sp.edit();
        modle = new ResModle("1","");
        listener = new ToudouListener<String>() {
            @Override
            public void onResponce(String l) {
                modle = new ResModle("s","");

            }

            @Override
            public void onFail(String msg) {

            }
        };
        // TODO: 2017/5/27



        btn_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                //Toasty.()
                android.os.Process.killProcess(android.os.Process.myPid());
                System.exit(0);
            }
        });
        btn_Co.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(intentC);
//                finish();
            }
        });
        btn_ho.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(intentH);
            }
        });
        btn_logout.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
        return view;
    }




}
